<?php if($search):?>
<h2>查询用户信息</h2>
<?php else:?>
<h2>修改用户信息</h2>
<?php endif?>
<?php echo CHtml::beginForm(array($search?'search':'admin'),'post');?>
<table  style="margin: 0 auto;"  width="1230">
<tr><td>
	用户名：<input type="text" name="keys[username]" size="5" value="<?php echo isset($_GET['keys']['username'])?$_GET['keys']['username']:'';?>"/>
	姓名：<input type="text" name="keys[true_name]" size="5" value="<?php echo isset($_GET['keys']['true_name'])?$_GET['keys']['true_name']:'';?>"/>
	模糊查询：<input type="radio" name="keys[blur]" value="1" checked/>是  
	<input type="radio" name="keys[blur]" value="0" <?php echo isset($_GET['keys']['blur'])&&$_GET['keys']['blur']==0?'checked':'';?>/>否 
	<input type="submit" value="搜索"/>
</td></tr></table>
<?php echo CHtml::endForm();?>
<table class="dataGrid"   width="1230">
  <thead>
  <tr>
    <th  width="100"><?php echo $sort->link('username'); ?></th>
    <th  width="80"><?php echo $sort->link('true_name'); ?></th>
    <th  width="50"><?php echo $sort->link('sex'); ?></th>
    <th  width="90"><?php echo $sort->link('company'); ?></th>
    <th  width="90"><?php echo $sort->link('department'); ?></th>
    <th  width="90"><?php echo $sort->link('position'); ?></th>
    <th  width="100"><?php echo $sort->link('office'); ?></th>
    <th  width="120"><?php echo $sort->link('duty'); ?></th>
    <th width="100"><?php echo $sort->link('region'); ?></th>
    <th width="100"><?php echo $sort->link('mobile_no'); ?></th>
    <th width="60"><?php echo $sort->link('educational_background'); ?></th>
    <th width="50"><?php echo $sort->link('household_register'); ?></th>
    <th width="100"><?php echo $sort->link('card_id'); ?></th>
	<?php if(!$search):?><th width="100">操作</th><?php endif ?>
  </tr>
  </thead>
  <tbody>
<?php foreach($models as $n=>$model): ?>
  <tr class="<?php echo $n%2?'even':'odd';?>">
  	<?php 
    	$url=array('show','id'=>$model->id)+$_GET;//把所有参数包括页码、查询参数传入显示信息页面
    	$url['ret']=$search?'search':'admin';
    ?>
    <td><?php echo CHtml::link($model->username,$url); ?></td>
    <td><?php echo CHtml::encode($model->true_name); ?></td>
    <td><?php echo CHtml::encode($model->sex==0?'男':'女'); ?></td>
    <td><?php echo CHtml::encode($model->company); ?></td>
    <td><?php echo CHtml::encode($model->department); ?></td>
    <td><?php echo CHtml::encode($model->position); ?></td>
    <td><?php echo CHtml::encode($model->office); ?></td>
    <td><?php echo CHtml::encode($model->duty); ?></td>
    <td><?php echo CHtml::encode($model->region); ?></td>
    <td><?php echo CHtml::encode($model->mobile_no); ?></td>
    <td><?php echo CHtml::encode($model->educational_background); ?></td>
    <td><?php echo CHtml::encode($model->household_register); ?></td>
    <td><?php echo CHtml::encode($model->card_id); ?></td>
    <?php if(!$search):?>
    <td>
      <?php echo CHtml::link('修改',array('update','id'=>$model->id)+$_GET); ?>
     <?php echo CHtml::link('删除',array('delete','id'=>$model->id)+$_GET,array('confirm'=>"确定要删除{$model->true_name}的信息吗？")); ?>
	</td>
	<?php endif ?>
  </tr>
<?php endforeach; ?>
  </tbody>
</table>
<br/>
<?php $this->widget('CLinkPager',array('pages'=>$pages,'htmlOptions'=>array('style'=>'width:1230px;'))); ?>
